<script setup lang="ts">
import { NSelect } from 'naive-ui'
import { SECTOR_DICT } from '@/constants/biz'

type PropsType = {
  value?: string
}
const props = defineProps<PropsType>()
const emits = defineEmits<{
  'update:value': [string]
}>()

const sectorOptions = Object.keys(SECTOR_DICT).map((key) => ({
  label: SECTOR_DICT[key as unknown as keyof typeof SECTOR_DICT],
  value: key
}))

const handleSelectChange = (value: string) => {
  emits('update:value', value)
}
</script>

<template>
  <NSelect
    style="width: 200px"
    :defaultValue="props.value || undefined"
    :options="sectorOptions"
    placeholder="请选择行业类型"
    :clearable="true"
    @update:value="handleSelectChange"
  ></NSelect>
</template>

<style lang="scss" scoped></style>
